//##########################################################################
//#                                                                        #
//#                            CLOUDCOMPARE                                #
//#                                                                        #
//#  This program is free software; you can redistribute it and/or modify  #
//#  it under the terms of the GNU General Public License as published by  #
//#  the Free Software Foundation; version 2 of the License.               #
//#                                                                        #
//#  This program is distributed in the hope that it will be useful,       #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
//#  GNU General Public License for more details.                          #
//#                                                                        #
//#          COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI)             #
//#                                                                        #
//##########################################################################

#ifndef STD_PLUGIN_INTERFACE_HEADER
#define STD_PLUGIN_INTERFACE_HEADER

//Qt
#include <QtWidgets/QActionGroup>
#include <QtWidgets/QWidget>

#include "DefaultPluginInterface.h"
#include "MainAppInterface.h"


class MainAppInterface;


//! Standard CC plugin interface
/** Version 1.5
	The plugin is now responsible for its own actions (QAction ;)
	and the associated ccMainAppInterface member should give it
	access to everything it needs in the main application.
**/
class  StdPluginInterface : public DefaultPluginInterface
{	
public:

	//! Default constructor
    StdPluginInterface( const QString &resourcePath = QString() ) :
        DefaultPluginInterface( resourcePath )
	  , m_app(nullptr)
	{
	}
	
	//! Destructor
    ~StdPluginInterface() override = default;

	//inherited from ccPluginInterface
    PLUGIN_TYPE getType() const override { return UNKN_STD_PLUGIN; }

	//! Sets application entry point
	/** Called just after plugin creation by qCC
	**/
    virtual void setMainAppInterface(MainAppInterface* app)
	{
		m_app = app;
		
		if (m_app)
		{
			//we use the same 'unique ID' generator in plugins as in the main
			//application (otherwise we'll have issues with 'unique IDs'!)

		}
	}

	//! A callback pointer to the main app interface for use by plugins
	/**  Any plugin (and its tools) may need to access methods of this interface
	**/
    virtual MainAppInterface * getMainAppInterface() { return m_app; }

	//! Get a list of actions for this plugin
//	virtual QList<QAction *> getActions() = 0;

    virtual QMap<QString,QList<QAction *>> getActions()=0;
    virtual QString getCatogry()=0;
    virtual QList<QWidget *> getWidgets() =0;


	//! This method is called by the main application whenever the entity selection changes
	/** Does nothing by default. Should be re-implemented by the plugin if necessary.
		\param selectedEntities currently selected entities
	**/

protected:

	//! Main application interface
    MainAppInterface* m_app;
};

Q_DECLARE_METATYPE(const StdPluginInterface *);

Q_DECLARE_INTERFACE(StdPluginInterface,"edf.rd.StdPluginInterface/1.4")

#endif //STD_PLUGIN_INTERFACE_HEADER
